package cn.iocoder.yudao.module.resource.dal.mysql.collect;

import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.resource.dal.dataobject.collect.ResourceCollectDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 用户收藏 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface ResourceCollectMapper extends BaseMapperX<ResourceCollectDO> {

    default List<ResourceCollectDO> selectListByUserId(Long userId) {
        return selectList(ResourceCollectDO::getUserId, userId);
    }

    default ResourceCollectDO selectByUserIdAndMaterialId(Long userId, Long materialId) {
        return selectOne(ResourceCollectDO::getUserId, userId,
                ResourceCollectDO::getMaterialId, materialId);
    }

}
